<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="el1">hello</div>
    <p id="el2"></p>
    <img src="./images/fruit1.png" id="img1"/>
<script>
    //获取元素节点的nodeName是该元素标签名的大写
    //获取文本节点的nodeName是#test
    var el1 = document.getElementById("el1");
    var el2 = document.getElementById("el2");
    var img1 = document.getElementById("img1");
    console.log(el1.nodeName, el2.nodeName, img1.nodeName);
    console.log(el1.firstChild.nodeName);
</script>
</html>